#pragma once

#include "usbd_core.h"
#include "usbd_cdc.h"

typedef struct
{
    uint8_t cmd;
    void (*func)(uint8_t* data,uint16_t len);
}cmd_msg_list;


typedef enum {
    SET_KEY         =       0x01,
    GET_KEY         =       0x02,
    GET_LOGS        =       0x03,
}usb_cmd_set;


#define USB_MSG_BUFF_SIZE   1024
#define PACK_HEAD_LEN   (2)

void usbh_connect_init();
void usbh_disconnect_deinit();
uint8_t get_usbd_reply_state();

void usbh_recv_msg_deal(uint8_t* data,uint16_t len);
void usb_cache_recv_data(uint8_t* src,int len);
void usb_recv_process(void (func)(uint8_t*,uint16_t),const uint8_t* head,uint8_t head_len);